Communication networks typically include network elements, which transfer or switch data from one or more sources to one or more destinations. For example, the network element may receive a data unit from a source device (or another network element), may determine a destination for the data unit, and may send an original or a modified data unit to a destination device (or another network element). A network element may function as a firewall that may filter packets based on one or more filters. For example, a firewall may forward a first packet and drop a second packet based on running a filter on the first and second packets. While a firewall may be implemented via software installed on the network element, such an implementation may be too slow. Thus, a firewall may be implemented within the hardware of the network element. However, a hardware implementation of a firewall may impose limits on the complexity of the filters.